package com.boarsoft.boar.office.meeting.biz;

import java.util.List;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.boarsoft.boar.office.entity.MeetingUser;
import com.boarsoft.boar.office.meeting.MeetingUserBiz;
import com.boarsoft.common.Util;
import com.boarsoft.hibernate.biz.SimpleBizImpl;

@Component("meetingUserBiz")
public class MeetingUserBizImpl extends SimpleBizImpl implements MeetingUserBiz {
	@Override
	@Transactional(readOnly = true)
	public List<MeetingUser> list(String meetingId, String userId) {
		StringBuilder sb = new StringBuilder();
		sb.append(" from ").append(MeetingUser.class.getName());
		sb.append(" where 1=1");
		if (Util.strIsNotEmpty(meetingId)) {
			sb.append(" and meetingId = '").append(meetingId).append("'");
		}
		if (Util.strIsNotEmpty(userId)) {
			sb.append(" and userId = '").append(userId).append("'");
		}
		return dao.list(sb.toString(), MeetingUser.class);
	}
}